home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / scrolvb / scroll_x.frm (.txt) < prev   
Encoding:
Visual Basic Form  |  1996-06-12  |  3.0 KB  |  84 lines

  1. VERSION 2.00
  2. Begin Form frmScroll 
  3.    BackColor       =   &H00FFFF00&
  4.    BorderStyle     =   0  'None
  5.    Caption         =   "frmScroll"
  6.    ClientHeight    =   615
  7.    ClientLeft      =   2580
  8.    ClientTop       =   3780
  9.    ClientWidth     =   3975
  10.    ControlBox      =   0   'False
  11.    Height          =   1020
  12.    Left            =   2520
  13.    LinkTopic       =   "Form2"
  14.    MaxButton       =   0   'False
  15.    MDIChild        =   -1  'True
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   41
  18.    ScaleMode       =   3  'Pixel
  19.    ScaleWidth      =   265
  20.    Top             =   3435
  21.    Width           =   4095
  22.    Begin CommandButton cmdHome 
  23.       Caption         =   "Home"
  24.       Height          =   375
  25.       Index           =   0
  26.       Left            =   2040
  27.       TabIndex        =   1
  28.       Top             =   120
  29.       Width           =   1815
  30.    End
  31.    Begin CommandButton cmdStart 
  32.       Caption         =   "Click To Start"
  33.       Height          =   375
  34.       Left            =   120
  35.       TabIndex        =   0
  36.       Top             =   120
  37.       Width           =   1815
  38.    End
  39. ' scroll_X.FRM - Declarations.
  40.     DefInt A-Z
  41. ' End Of Declarations.
  42. Sub cmdHome_Click (Index As Integer)
  43. ' All of these buttons just move the scrolling form back up to the upper
  44. ' left corner, where it was before you started scrolling.
  45.     frmScroll.Move 0, 0
  46. End Sub
  47. Sub cmdStart_Click ()
  48. ' Hide this button right away.
  49.     cmdStart.Visible = False
  50. ' These are the PIXEL sizes that the scrolling form will be. Any number
  51. ' up to 32000 is alright. Over that size, things get flakey!
  52.     GoalWidth = 400
  53.     GoalHeight = 400
  54. ' Since the MDI child form external size is "Twips", you must convert the
  55. ' pixel goal to Twips, and THEN actually change the form size. In other
  56. ' words, when you give VB a Width or Height value, it expects a Twip value.
  57. ' To get this Twip value, you multiply your pixel size goal times the
  58. ' "number of Twips per pixel". VB has a built-in "Screen" object that will
  59. ' give you that number (it varies with different monitor types).
  60.     frmScroll.Width = GoalHeight * Screen.TwipsPerPixelX
  61.     frmScroll.Height = GoalHeight * Screen.TwipsPerPixelY
  62. ' Now duplicate the "Home" command button a few times, just to have some
  63. ' other sample controls on the form. These are not critical, and can be
  64. ' removed and replaced with any other kind of control.
  65.     For temp = 1 To 15
  66.     Load cmdHome(temp)
  67.     Next temp
  68. ' Adjust all of the cmdHome buttons, including #0, which was on the form
  69. ' at design time.
  70.     For x = 0 To 3
  71.     For y = 0 To 3
  72.         ' Figure out which one to move (0 to 15).
  73.         temp = (y * 4) + x
  74.         ' Calculate new location.
  75.         offsetX = 10 + (x * 100)
  76.         offsetY = 30 + (y * 100)
  77.         ' Move it, change caption, and show it.
  78.         cmdHome(temp).Move offsetX, offsetY, 80, 40
  79.         cmdHome(temp).Caption = "Home #" + Trim(temp)
  80.         cmdHome(temp).Visible = True
  81.     Next y
  82.     Next x
  83. End Sub
  84.